package com.sc.nft.controller;

import com.sc.nft.annotation.UserLogin;
import com.sc.nft.dto.IdRequest;
import com.sc.nft.feign.WxMiniRedeemCardClient;
import com.sc.nft.req.redeemcard.RedeemCardPageReq;
import com.sc.nft.req.redeemcard.RedeemCardReq;
import com.sc.nft.req.redeemcard.RedeemCardRuleReq;
import com.sc.nft.sup.PageRequest;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.redeemcard.RedeemCardDetailsVO;
import com.sc.nft.vo.redeemcard.RedeemCardPageVO;
import com.sc.nft.vo.redeemcard.RedeemCardWebDetailsVO;
import com.sc.nft.vo.redeemcard.RedeemCardWebPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/ipMall/wxMiniMall/user/redeemCard")
@Api(tags = "用户端小程序兑换卡")
public class WxMiniRedeemCardController {

    private final WxMiniRedeemCardClient wxMiniRedeemCardClient;



    /**
     * 小程序用户端兑换卡列表
     * @param request
     * @return
     */
    @PostMapping(value = "/webPage", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "用户端兑换卡列表")
    @UserLogin
    public PageResult<RedeemCardWebPageVO> webPage(@RequestBody PageRequest request) {
        return wxMiniRedeemCardClient.webPage(request);
    }


    /**
     * 用户端兑换卡详情
     * @param request
     * @return
     */
    @PostMapping(value = "/webDetails", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "用户端兑换卡详情")
    @UserLogin
    public Result<RedeemCardWebDetailsVO> webDetails(@RequestBody IdRequest request) {
        return wxMiniRedeemCardClient.webDetails(request);
    }



}